﻿#pragma once

#include "core/Color.h"
#include "function/RenderSystem/RendererAPI.h"
#include "function/RenderSystem/AbstractBuffer.h"
#include "function/RenderSystem/AbstractShader.h"
#include "Camera/Camera.h"
#include "core/Macro.h"

namespace Engine
{
	class ENGINE_API AbstractRenderer
	{
	public:
		virtual ~AbstractRenderer() = default;

		virtual void Init() = 0;

		static void BeforeRender(const Color4& clearColor, const Camera& camera);
		static void Submit(const Ref<VertexArray>& vertexArray, const Ref<AbstractShader>& shader);
		static void AfterRender();

		virtual void Draw(const Ref<VertexArray>& vertexArray) = 0;

		virtual void SetClearColor(const Color4& color) = 0;
		virtual void Clear() = 0;

		static RendererAPI::API GetAPI() { return RendererAPI::GetAPI(); }

	private:
		struct RendererData
		{
			glm::mat4 viewProjectionMatrix;
		};

		static RendererData* rendererData;
	};
}
